package cn.ondraw.ragflow.service.impl;

import cn.hutool.json.JSONUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import cn.ondraw.ragflow.pojo.response.ModelListResponse;
import cn.ondraw.ragflow.service.LLMService;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

@Service
@Slf4j
@RequiredArgsConstructor
public class LLMServiceImpl implements LLMService {
    private final PythonApiCaller pythonApiCaller;

    @Override
    public ModelListResponse llmList() {
        // 构建请求的 URL
        String url = "/v1/llm/list";
        ResponseEntity<?> response = pythonApiCaller.callGetApi(url,false);
        return JSONUtil.toBean(response.getBody() != null ? response.getBody().toString() : null, ModelListResponse.class, true);
    }
}
